const arr = [1, 5, 21, 2, 65, 34, 98, 42]

console.log(arr.sort());
console.log(arr.sort((x, y) => {
  return x - y
}));
// 返回正数，升序，返回负数，降序